console.log('加载成功')
let u = navigator.userAgent;
let android = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
let isDayNextkDate = '',isDayNextkZudou = '',isDouNextkDate = '',dateNow = '',dateDate = '',nextTimeGetTongZhu = '',nextTimeLedou = '',nextTimeShouhua = '',nextTimeShoucai = '',xiaowushuafenTime = '',shuatieTime = '',xiaowushuafenTimeType = '',shuatieTimeType = '',suijishijianTime = '';
if(android){
    var btnlist = document.getElementsByTagName('button') || [];
    for(var i=0;i<btnlist.length;i++){
        btnlist[i].style.height = "18px"
        btnlist[i].style.fontSize = "12px"
        btnlist[i].style.padding = "0"
        btnlist[i].style.width = "66px"
    }
}
let shuatieIndex = 0
let fatieIndex = 0
let shuatieList = [
    '春草明年绿，王孙归不归?',
    '又送王孙去，萋萋满别情。',
    '好雨知时节，当春乃发生。',
    '空山新雨后，天气晚来秋。',
    '这台手术很成功，我失败的人生结束了。',
    '人的心脏都在左边，我们要如何拥抱才能心心相印。',
    '我闭上眼睛触碰星空，阅读宇宙留给我的盲文。',
    '有目的地的人生才会迷路，我只是来世界散步。',
    '停车这人是瞎子吧，不然为什么把车停盲道上。',
    '为了不留遗憾，我带着遗憾离开了那个地方。',
    '客舍并州已十霜，归心日夜忆咸阳。无端更渡桑干水，却望并州是故乡。',
    '谁家玉笛暗飞声，散人春风满洛城。此夜曲中闻折柳，何人不起故国情。',
    '床前明月光，疑是地上霜。举头望明月，低头思故乡。',
    '人春才七日，离家已二年。人归落雁后，思发在花前。',
    '海日生残夜，江春入旧年。乡书何处达，归雁洛阳边。',
    '岭外音书断，经冬复立春。近乡情更怯，不敢问来人。',
    '少小离家老大回，乡音无改鬓毛衰。儿童相见不相识，笑问客从何处来?',
    '君自故乡来。应知故乡事。来日绮窗前，寒梅着花未?',
    '稚子牵衣问，归来何太迟?共谁争岁月，赢得鬓边丝?',
    '邯郸驿里逢冬至，抱膝灯前影伴身。想得家中夜深坐，还应说着远行人。',
    '独在异乡为异客，每逢佳节倍思亲。遥知兄弟登高处，遍插茱萸少一人。',
    '洛阳城里见秋风，欲作家书意万重。复恐匆匆说不尽，行人临发又开封。',
    '烽火连三月，家书抵万金。',
    '煮豆燃豆萁，豆在釜中泣。本是同根生，相煎何太急。',
    '谁言寸草心，报得三春晖。',
    '山回路转不见君，雪上空留马行处。',
    '孤帆远影碧空尽，唯见长江天际流。',
    '桃花潭水三千尺，不及汪伦送我情。',
    '莫愁前路无知己，天下谁人不识君。',
    '寒雨连江夜入吴，平明送客楚山孤。',
    '与君离别意，同是宦游人。海内存知己，天涯若比邻。',
    '瀚海阑干百丈冰，愁云惨淡万里凝。',
    '昨夜西风凋碧树，独上高楼，望尽天涯路。',
    '枯藤老树昏鸦，小桥流水人家，古道西风瘦马。',
    '泉眼无声惜细流，树阴照水爱晴柔。',
    '沉舟侧畔千帆过，病树前头万木春。',
    '晴川历历汉阳树，芳草萋萋鹦鹉洲。',
    '忽如一夜春风来，干树万树梨花开。',
    '碧玉妆成一树高，万条垂下绿丝绦。',
    '夜曲中闻折柳，何人不起故园情。',
    '最是一年春好处，绝胜烟柳满皇都。',
    '渭城朝雨浥轻尘，客舍青青柳色新。',
    '山重水复疑无路，柳暗花明又一村。',
    '沾衣欲湿杏花雨，吹面不寒杨柳风。',
    '乱花渐欲迷人眼，浅草才能没马蹄。',
    '独怜幽草涧边生，上有黄鹂深树鸣。',
    '天苍苍，野茫茫，风吹草低见牛羊。',
    '窗含西岭千秋雪，门泊东吴万里船。',
    '北风卷地白草折，胡天八月即飞雪。',
    '清明时节雨纷纷，路上行人欲断魂。',
    '水光潋滟晴方好，山色空蒙雨亦奇。',
    '渭城朝雨浥轻尘，客舍青青柳色新。劝君更尽一杯酒，西出阳关无故人。',
    '妈妈做的面我可以直接吃，方便面却还需要自己泡，真不知道到底方便在那儿。',
    '戍鼓断人行，边秋一雁声。露从今夜白，月是故乡明。有弟皆分散，无家问死生。寄书长不达，况乃未休兵。',
    '戍鼓断人行，边秋一雁声。露从今夜白，月是故乡明。有弟皆分散，无家问死生。寄书长不达，况乃未休兵。',
    '爷娘闻女来，出郭相扶将；阿姊闻妹来，当户理红妆；小弟闻姊来，磨刀霍霍向猪羊。',
    '长亭外，古道边，芳草碧连天。晚风拂柳笛声残，夕阳山外山。天之涯，海之角，知交半零落。一觚浊酒尽余欢，今宵别梦寒。',
]
setInterval(function(){
    // // 每天的0点0分，先访问一次神兽首页重置体力-弃用
    // var isRef = localStorage.getItem('texun_yyxhType') || 0;// 是否进入体力重置方法
    // var dateHours = dateNow.getHours(); // 当前小时数
    // var dateMinutes = dateNow.getMinutes(); // 当前分钟数
    // 如果下次执行任务的日期 == 当前日期*号数，且任务队列未被占用。那么就要执行当天的任务了
    // texun_isDayMask = 1、正在任务中，2、空闲中
    // if(isRef == 1 && dateHours == 0 && dateMinutes == 0){
    //     nextTimeGetTongZhu = nextTimeGetTongZhu + 61000;
    //     nextTimeLedou = nextTimeLedou + 61000;
    //     localStorage.setItem('nextTimeGetTongZhu',nextTimeGetTongZhu);
    //     localStorage.setItem('nextTimeLedou',nextTimeLedou);
    //     localStorage.setItem('texun_yyxhType',0);
    //     localStorage.setItem('resetShenshouTili',1);
    //     setTimeout(function() {
    //         window.location.href = './shabi2.html';
    //     }, 300);
    // }
    // && localStorage.getItem('texun_isDayMask') == 2
    // && localStorage.getItem('texun_isDayMask') == 2
    shuatieIndex = Math.floor(Math.random()*shuatieList.length)
    fatieIndex = Math.floor(Math.random()*(shuatieList.length - 10))
    isDayNextkZudou = localStorage.getItem('texun_isDayNext_zudou') || 0;// 下次执行族斗的日期
    isDayNextkDate = localStorage.getItem('texun_isDayNext_data') || 0;// 下次执行任务的日期
    isDouNextkDate = localStorage.getItem('texun_isDouNext_data') || 0;// 下次执行斗兽任务的日期
    dateNow = new Date();
    dateDate = dateNow.getDate(); // 当前日期*号数
    nextTimeGetTongZhu = Number(localStorage.getItem('nextTimeGetTongZhu'));// 判断是否可以偷取小号铜珠
    nextTimeLedou = Number(localStorage.getItem('nextTimeLedou'));// 判断是否可以乐斗
    nextTimeShouhua = Number(localStorage.getItem('nextTimeShouhua'));// 判断是否可以收花
    nextTimeShoucai = Number(localStorage.getItem('nextTimeShoucai'));// 判断是否可以收菜

    // 刷分开始
    xiaowushuafenTime = Number(localStorage.getItem('xiaowushuafenTime') || 0);// 小屋刷分
    xiaowushuafenTimeType = localStorage.getItem('xiaowushuafenTimeType');// 小屋刷分
    suijishijianTime = parseInt(Math.random()*98765) + 214567;
    document.getElementById('setInterval').innerText = (suijishijianTime/10000 + Math.random()).toFixed(2)
    if((dateNow.getTime() - xiaowushuafenTime) > suijishijianTime && xiaowushuafenTimeType == 1){
        localStorage.setItem('xiaowushuafenTime',dateNow.getTime());
        $.post("http://129.28.24.210/bbs/marriage/room/talk_add.aspx?rid=349&sid=" + token,{dtext:"我爱你",});
    }
    // 刷分结束

    // 刷帖开始
    shuatieTime = Number(localStorage.getItem('shuatieTime') || 0);// 刷帖
    shuatieTimeType = localStorage.getItem('shuatieTimeType');// 刷帖
    // suijishijianTime = parseInt(Math.random()*98765) + 214567;
    // if((dateNow.getTime() - shuatieTime) > suijishijianTime && shuatieTimeType == 1){
    let huitieIDList = localStorage.getItem('texun_huitie_id') ? localStorage.getItem('texun_huitie_id').split('.') : []
    if(((shuatieTimeType == 1 && new Date().getHours() < 3) || shuatieTimeType == 2) && huitieIDList.length > 0){
        let huitieID = huitieIDList[Number(new Date().getDate() - 1)]
        localStorage.setItem('shuatieTime',dateNow.getTime());
        $.post("http://129.28.24.210/bbs/reply_add.aspx?id="+huitieID+"&sid=" + token,{cont:shuatieList[shuatieIndex],act: 'ok'});
    }
    // 发帖
    // if(shuatieTimeType == 1){
    //     localStorage.setItem('shuatieTime',dateNow.getTime());
    //     $.post("http://129.28.24.210/bbs/topic_add.aspx?id=9859&sid=" + token,{name:shuatieList[fatieIndex],dtext:'长亭外，古道边，芳草碧连天。晚风拂柳笛声残，夕阳山外山。天之涯，海之角，知交半零落。一觚浊酒尽余欢，今宵别梦寒。',act: '发表',});
    // }
    // 刷帖结束
    // 执行每日族斗报名
    
    if(isDayNextkZudou == dateDate && dateNow.getHours() == '20' && dateNow.getMinutes() == '58' && localStorage.getItem('nextTimeGetDayZudou') != 2){
        console.log('可以执行每日族斗了')
        localStorage.setItem('nextTimeGetDayZudou',1);
        setTimeout(function() {
            window.location.href = './shabi1.html';
        }, 100);
    }
    else if(isDayNextkDate == dateDate && localStorage.getItem('texun_isDayMask') == 2){
        console.log('可以执行每日任务了')
        localStorage.setItem('nextTimeGetDayMask',1);
        setTimeout(function() {
            window.location.href = './shabi3.html';
        }, 200);
    }
    else if(dateNow.getTime() >= nextTimeGetTongZhu && localStorage.getItem('texun_isDayMask') == 2){
        localStorage.setItem('nextTimeGetTongZhuTrue',1);
        setTimeout(function() {
            window.location.href = './shabi2.html';
        }, 400);
    }
    else if(dateNow.getTime() >= nextTimeLedou && localStorage.getItem('texun_isDayMask') == 2){
        localStorage.setItem('nextTimeLedouTrue',1);
        setTimeout(function() {
            window.location.href = './shabi1.html';
        }, 600);
    }
    else if(dateNow.getTime() >= nextTimeShouhua && localStorage.getItem('texun_isDayMask') == 2){
        localStorage.setItem('nextTimeShouhuaTrue',1);
        setTimeout(function() {
            window.location.href = './shabi1.html';
        }, 800);
    }
    else if(dateNow.getTime() >= nextTimeShoucai && localStorage.getItem('texun_isDayMask') == 2){
        localStorage.setItem('nextTimeShoucaiTrue',1);
        setTimeout(function() {
            window.location.href = './shabi1.html';
        }, 1000);
    }
    else if(isDouNextkDate == dateDate && localStorage.getItem('texun_isDayMask') == 2){
        console.log('可以执行每日斗兽任务了')
        localStorage.setItem('nextTimeGetDouMask',1);
        setTimeout(function() {
            window.location.href = './shabi4.html';
        }, 1200);
    }
    let nextTime5 = document.getElementById('nextTime5');
    if(nextTime5){
        nextTime5.innerText = `
            当前任务状态值：${localStorage.getItem('texun_isDayMask')}
        `;
    }
},30000)
